#include <iostream>
using namespace std;

int main()
{
    int arr[10] = {31, 45, 21, 458, 4631, 7441, 2124, 123, 4, 18};

    for (int i = 0; i < 10; i++)
    {
        int flag = 0;
        for (int j = i; j < 9; j++)
        {
            if (arr[i] > arr[j + 1])
            {
                int temp = arr[i];
                arr[i] = arr[j + 1];
                arr[j + 1] = temp;
                flag = 1;
            }
        }
        if (flag == 0)  
        {
            break;
        }
        
    }

    for (int i = 0; i < 10; i++)
    {
        cout << arr[i] << " ";
    }

    return 0;
}